<?php
namespace app\api\controller\v1;
use think\Db;
use app\service\CouponService;
use think\Request;

class Bang extends Base
{
    public function _initialize()
    {
        parent::_initialize();
        $this->IsLogin(); //验证登录
    }


    public function send_uid(Request $request)
    {
        $param = $request->param();
        $user = $this->user;
        if ($user['top_id'] == 0){
            if ($param['uid'] != $user['id']){
                Db::name('user')->where('id',$user['id'])->update(['top_id'=>$param['uid']]);
                $param['msg'] = '绑定成功';
            }

        }else{
            $param['msg'] = '有上级';
        }
        echo json_encode($param);
    }

}